Recently, I used the Boost library for multi-thread development. It is visible that the compilation engineers in vs always encounter Macro redefinition errors, similar to the following error description.
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdint.h(116): warning C4005: 'INT8_C' : macro redefinition1> c:\vc\include\boost\cstdint.hpp(376) : see previous definition of 'INT8_C'
At the beginning, I was not responsible
Windows. H and winsock2.h contain sequence. Generally, when using C ++ for network development on the Windows platform, these two header files are included at the same time. If the sequence is improper (windows. h prior to winsock2.h. For example:
Warning 4 warning c4005: "af_ipx": Macro redefinition C:/program files/Microsoft sdks/Windows/v6.0a/include/ws2def. h 91Warning 5 Warning c4005: "af_max": Macro
Today, we changed the original project from MFC to a non-MFC project, and many errors have occurred. Now we have recorded them as backups.
Summary:
> C: \ Program Files \ microsoft sdks \ windows \ v6.0a \ include \ ws2def. H (91): Warning c4005: "af_ipx": Macro redefinition1> C: \ Program Files \ microsoft sdks \ windows \ v6.0a \ include \ Winsock. H (460): see the previous definition of "af_ipx ".1> C: \ Program Files \ microsoft sdks \ windows \ v
Get followings error and warnings when building project:Error Rc1205:invalid code pageWarning C4005: ' __useheader ': Macro redefinitionWarning C4005: ' __on_failure ': Macro redefinitionExplanation from Msdn:resource Compiler Fatal Error RC1205The Specify code page (/c) option is followed by an invalid code page. See Code Pages in the run-time Library Reference for more information.Check following items:1.
push_macro and # pragma pop_macro. The former pushes the specified macro into the stack, which is equivalent to temporary storage for future use. The latter pushes the macro at the top of the stack, and the pop-up macro will overwrite the macro with the same name as the current one. For example: 1: #include 2: #define X 1 3: #define Y 2 4: 5: int main() { 6: printf("%d",X); 7: printf("\n%d",Y); 8: #define Y 3 // C4005 9: #pragma
Resolving conflicts between Winsock.h and Winsock2.h in VS2010 (repeating definition)--ReprintWhen these two header files are reversed, there are many confusing errors in the compilation, with the following errors:1>...\include\ws2def.h: Warning C4005: ' af_ipx ': Macro redefinition1>...\include\winsock.h (460): See previous definition of ' af_ipx '...Or the mistake.#error "Ws2tcpip.h is not a compatible with winsock.h. Include winsock2.h instead. "[c
qt4.86, a warning is issued, prompting that the macro definition is repeated:1> C: \ QT \ 4.8.6 _ 2008 \ include \ qtcore \.. /.. /src/corelib/global/qconfig. H (41): Warning c4005: 'qt _ largefile_support ': Macro redefinition1> command-line arguments: see previous definition of 'qt _ largefile_support'Create an empty project using vs2008 and use the same qt4.86 library.
Bytes -------------------------------------------------------------------------
The processing of warning C4005: 'winver ': macro redefinition is in Windows. h has the following definitions: # ifndef WINVER # define WINVER 0x0400 # endif if you place # define WINVER 0x500 in # include
Files to be included: # include "Winuser. h"
Hcursor getcur () {cursorinfo hcur; // hcursor hcur; zeromemory ( hcur, sizeof (hcur); hcur. cbsize = sizeof (hcur); getcursorinfo ( hcur); Return hcur. hcursor ;}void cmy123dlg: onbutton1 () {sleep (20
declared with __declspec (allocate).#pragma push_macro and #pragma pop_macro. The former pushes the specified macro into the stack, which is equivalent to temporarily storing it for later use, and the latter pushes the top macro out of the stack, and the macro that pops up overrides the current name. For example: 1: #include 2: #define X 1 3: #define Y 2 5:int Main () { 6:printf ("%d", X); 7: printf ("\n%d", Y); 8: #define Y 3 //C4005
The recent use of boost library for multithreaded development, visual in VS compiler engineers always encounter macro redefinition error, similar to the following error description
1>c:\program files (x86) \microsoft Visual Studio 10.0\vc\include\stdint.h (116): Warning C4005: ' int8_c ': Macro Redefi Nition
1> c:\vc\include\boost\cstdint.hpp (376): Previous definition of ' int8_c '
At first no tube, visible later this thing is really slow to compi
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.